package com.xmu.edu.tisp.diyview;

/**
 * 
 * @author TISP
 * 
 */
public class ObjectEntity implements Comparable {

	private String objectCd;
	private String objectName;
	private String pinyin;
	private String objectid;
	private String firstcharacter;

	public ObjectEntity(String objectid, String objectCd, String objectName) {
		this.objectid = objectid;
		this.objectCd = objectCd;
		this.objectName = objectName;
		if (objectName == null) {
			pinyin = "NULL";
			this.objectName = "NULL";
		} else if (objectName.matches("[a-z|A-Z|-| ]+"))
			pinyin = objectName;
		else
			pinyin = pinyin4j.getFirstCharacter(objectName);
		this.firstcharacter = pinyin.substring(0, 1);
	}

	@Override
	public int compareTo(Object another) {
		ObjectEntity o2 = (ObjectEntity) another;
		return pinyin.compareTo(o2.pinyin);
		// return 0;
	}

	public String getPinyin() {
		return pinyin;
	}

	public void setPinyin(String pinyin) {
		this.pinyin = pinyin;
	}

	public String getObjectCd() {
		return objectCd;
	}

	public void setObjectCd(String objectCd) {
		this.objectCd = objectCd;
	}

	public String getObjectName() {
		return objectName;
	}

	public void setObjectName(String objectName) {
		this.objectName = objectName;
	}

	public String getObjectid() {
		return objectid;
	}

	public void setObjectid(String objectid) {
		this.objectid = objectid;
	}

	public String getFirstcharacter() {
		return firstcharacter;
	}

	public void setFirstcharacter(String firstcharacter) {
		this.firstcharacter = firstcharacter;
	}

}
